package com.own.demo.长沙空中路网格子.v2;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.locationtech.jts.geom.Coordinate;

import java.util.List;
import java.util.concurrent.CountDownLatch;

public class 对角线DrawEvp extends PatentCode implements Runnable {
    List<List<Coordinate>> xy;
    JSONObject  jsonAllData;
    private CountDownLatch countDownLatch;

    public 对角线DrawEvp(List<List<Coordinate>> allXYdata,
                      CountDownLatch countDownLatch, JSONObject jsonAllData) {
        this.xy = allXYdata;
        this.countDownLatch = countDownLatch;
        this.jsonAllData = jsonAllData;
    }

    @Override
    public void run() {
        try {
            addLine(jsonAllData,dataDrawJson());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            countDownLatch.countDown();
        }
    }

    public  JSONArray dataDrawJson() {
        JSONArray jsonArray = new JSONArray(1024);
        int row = xy.size();
        String geoType="LineString";
        for (int i = 0; i < row; i++) {
            jsonArray.addAll(setXYGeo(i, 0, xy.get(i), geoType));
        }
        return jsonArray;
    }


}
